package org.dbstar.scheduler.job;

import java.util.Map;

import org.dbstar.scheduler.beans.Job;
import org.dbstar.scheduler.beans.JobConf;


/**
 * 构建Job的工厂类
 * 
 * @author 代波
 * @since 1.0.0
 * @version 1.0.0
 * @date 2012-4-28
 */
public interface JobFactory<T extends Job> {
	/**
	 * 构建Job
	 * 
	 * @param schedulerFactory 构建工厂实例
	 * @param conf JobConf
	 * @param submitter Job提交人
	 * @return 新构建的Job对象
	 * @throws IllegalFactoryException 若无法正确构建时抛出
	 */
	public abstract T createJob(SchedulerFactory schedulerFactory, JobConf conf, String submitter)
			throws IllegalFactoryException;

	/**
	 * 构建Job
	 * 
	 * @param schedulerFactory 构建工厂实例
	 * @param conf JobConf
	 * @param submitter Job提交人
	 * @param submitTime Job提交时间戳
	 * @return 新构建的Job对象
	 * @throws IllegalFactoryException 若无法正确构建时抛出
	 */
	public abstract T createJob(SchedulerFactory schedulerFactory, JobConf conf, String submitter, long submitTime)
			throws IllegalFactoryException;

	/**
	 * 构建Job
	 * 
	 * @param schedulerFactory 构建工厂实例
	 * @param conf JobConf
	 * @param submitter Job提交人
	 * @param parameters Job的参数
	 * @return 新构建的Job对象
	 * @throws IllegalFactoryException 若无法正确构建时抛出
	 */
	public abstract T createJob(SchedulerFactory schedulerFactory, JobConf conf, String submitter,
			Map<String, String> parameters) throws IllegalFactoryException;

	/**
	 * 构建Job
	 * 
	 * @param schedulerFactory 构建工厂实例
	 * @param conf JobConf
	 * @param submitter Job提交人
	 * @param parameters Job的参数
	 * @param submitTime Job提交时间戳
	 * @return 新构建的Job对象
	 * @throws IllegalFactoryException 若无法正确构建时抛出
	 */
	public abstract T createJob(SchedulerFactory schedulerFactory, JobConf conf, String submitter,
			Map<String, String> parameters, long submitTime) throws IllegalFactoryException;
}
